home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 4,401 to 4,500
/
aol-file-protocol-4400-4401-to-4500.zip
/
AOLDLs
/
PDA-Newton Development
/
ND Register Sample Code
/
RegisterSampleCode.sit
/
RegisterSampleCode ƒ
/
RegTest π.text
< prev
Wrap
Text File
|
1994-11-26
|
6KB
|
216 lines
constant kAppSymbol := '|RegTest:FlaSheridn| ;
constant kSharewareFee := 42;
//constant kSharewareFeeString := "$42"; //optional
constant kVersionString := "1.0d1";
write("\n" & "_______________________________________" & "\n"
& kAppSymbol && kVersionString &&
dateNTime(Time()) &
"\n" & "_______________________________________" & "\n" & "\n");
defconst( 'kReverseStringsFunc,
func(a,b,c)
begin
local inp := a && b && c ;
local out := "";
for i := 0 to strLen(inp) -1
do out := inp[i] & out;
return out;
end;
);
// ---- End Project Data ----
// ---- File RegTest Layout ----
RegTest :=
{title: "RegTest",
viewBounds: {left: -8, top: 34, right: 148, bottom: 214},
viewFormat: 83951953,
ShareWareFee: kSharewareFee,
VersionString: kVersionString,
IPaid:
func(frame)
begin
local regProg := sprintObject(frame.registrationProgram);
//Who the calling program _says_ it is; but it might be lying.
local amountText := frame.amountText; //may start with "<"
local amount := floor(stringToNumber(
Stringfilter(amountText, "0123456789,.", 'passAll)
));
local reliability := frame.reliability;
//Don't necessarily trust this number; see below.
Print ("Registered by" && regProg && "for" && "$" & amount) ;
local thanksMess :=
if amount < kSharewareFee then "Cheapskate"
else if amount > kSharewareFee then "Spendthrift"
else "New customer";
GetRoot():Notify(kNotifyQAlert,
ensureInternal(sprintObject(kAppSymbol)),
ensureInternal(thanksMess) );
end
/*
Note that the Ipaid method╒s reliability slot is the *calling* program's
estimate, which may be wrong or even dishonest. I don't recommend
relying exclusively on this method for verification of payment. The
current version of Register gives a reliability value of 1 (on a scale of 10);
this means that the user entered a number which bore a superficial
resemblance to a credit card number, and pressed the Action button.
It doesn't even indicate that the user put a mail message or a fax in his
Out Box. (That would be a 2, and would require some hacking on my part.),
much less that he actually mailed it and the order was received and
approved.
*/,
_proto: protoApp,
debug: "RegTest"
};
// ---- File MoneyButtonProto ----
_userproto000 :=
{
buttonClickScript:
func()
Begin
local RegView := GetRoot().(RegistrationPackage);
if not RegView then
begin
GetRoot():Notify(kNotifyQAlert,
ensureInternal("Shareware Registration"),
ensureInternal("I can╒t find" && sprintObject(RegistrationPackage) ) );
end
else
begin
RegView:?open();
RegView:?ExternalRegister(RegFrame);
end;
End,
viewBounds: {top: -16, left: -63, right: -48, bottom: -3},
viewJustify: 8388778,
RegFrame:
{package: kAppSymbol,
price: kSharewareFee,
platform: 'Newton,
//Version: kVersionString,
//version is optional
// Stuff below need only exist if the user is _not_ registering
// via the Kagi Shareware Clearinghouse.
// newRegistrationCompanies:
// [
// { Company: setclass("Yoyodyne Bank of Commerce", 'Company) ,
// Email: "John@home.org",
// Phones: [ setclass("911", 'faxPhone) ] }
// }
// ]
},
RegistrationPackage: '|Register:FlaSheridn|,
icon: GetPictAsBits("RegisterMoneyButton", nil),
_proto: protoPictureButton
};
// ---- Back in File RegTest Layout ----
_view000 := /* child of RegTest */ {_proto: _userproto000};
_view001 := /* child of RegTest */
{viewJustify: 166,
viewBounds: {top: -16, left: -42, right: -25, bottom: -3},
buttonClickScript:
func()
begin
GetRoot():Notify(kNotifyQAlert,
ensureInternal(sprintObject(kAppSymbol)),
ensureInternal("This is only a test for the protoMoneyButton. FlaSheridn@rahul.net" ) );
//inherited:?buttonClickScript(); // this method is defined internally
nil
end,
_proto: protoActionButton
};
weirdMoneyButton := /* child of RegTest */
{viewBounds: {top: -98, left: -84, right: -69, bottom: -85},
RegFrame:
{
package: '|PocketLucre:BCCI|,
Version: "1.02",
platform: 'Newton,
price: 2,
notes: "This is a rumor. This is only a rumor.",
newRegistrationCompanies:
[
{ Company: setclass("Bank of Commerce Etc.", 'Company) ,
Email: "Cliff@bcci.com",
Phones: [ setclass("408-524-9524", 'faxPhone) ]
}
]
},
_proto: _userproto000,
debug: "weirdMoneyButton"
};
ReallyStrangeButton := /* child of RegTest */
{viewBounds: {top: -66, left: -132, right: -117, bottom: -53},
RegFrame:
{package: '|CerealTool:OCP|,
price: 495,
platform: '|OS/2|,
Version: -42,
notes: "In the name of justice and a strong economy, Commander Cash says, \"Send in your shareware payments!\"",
// Stuff below need only exist if the user is _not_ registering
// via the Kagi Shareware Clearinghouse.
EncodingType: "reverse",
EncodingFunction: kReverseStringsFunc,
newRegistrationCompanies:
[
{ Company: setclass("Mediplex", 'Company) ,
Email: "chairman@ocp.com",
Phones: [ setclass("900-544-8444", 'faxPhone) ]
}
]
},
_proto: _userproto000,
debug: "ReallyStrangeButton"
};
// View ReallyStrangeButton is declared to RegTest
// ---- Beginning of section for non used Layout files ----
// End of output